import Vue from 'vue'
import App from './App.vue'
// npm i vuex@3   下载指定版vuex 并引入
import store from "./store/index"

// npm i vue-router@3 下载指定版本路由器 并引入
import vueRouter from "vue-router"
Vue.use(vueRouter)

import router from "./router/index"
// 解决编程式式路由重复点击报错的问题
let vueRouterPush = vueRouter.prototype.push
vueRouter.prototype.push = function push(to){
  return vueRouterPush.call(this,to).catch(err => err)
}
let vueRouterReplace = vueRouter.prototype.replace
vueRouter.prototype.replace = function replace(to){
  return vueRouterReplace.call(this,to).catch(err => err)
}

Vue.config.productionTip = false

new Vue({
  render: h => h(App), 
  beforeCreate(){
    // Vue.prototype.$bus = newVc
    Vue.prototype.$bus = this
  },
  router,
  store
}).$mount('#app')
